<!-- 高级组件-组织选择 dtSelectOrg组件，这里对其进行二次封装，为了处理api参数 -->
<template>
  <div>
    <dtSelectOrg :api="orgApi" v-bind="$attrs" :selectData="value"
                 @handleSelectData="handleSelectData" v-on="$listeners" />
  </div>
</template>

<script>
import { orgSelects, getOrgTreeByOrgIds } from '@/framework/api/developerCenter/elementRightPanel'

export default {
  props: {
    // 选中的值
    value: {
      type: Array,
      default: () => {
        return []
      }
    }
  },
  data() {
    return {
      orgApi: { getParentGroupDataScope: orgSelects, getOrgTreeByOrgIds }
    }
  },
  methods: {
    handleSelectData(val) {
      this.$emit('input', val.map((item) => {
        return {
          orgId: item.orgId,
          orgName: item.orgName
        }
      }))
    }
  }
}
</script>

<style type="text/css" scoped>
</style>
